home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / STRINGS / TPSTR7 / EXAM15.PAS < prev    next >
Pascal/Delphi Source File  |  1993-03-11  |  5KB  |  104 lines

  1. Program Exam15;
  2.  
  3. {**************************************************************************}
  4. {                                                                          }
  5. { Ce programme démontre les possibilités de ChrPosRxx.                     }
  6. {                                                                          }
  7. {**************************************************************************}
  8.  
  9. Uses
  10.   TpStr;
  11.  
  12. Var
  13.   S1 ,
  14.   S2 : String;
  15.   I  : Integer;
  16. {  ---------------------------------------------------------------         }
  17. {  Function    ChrPosR(Str: String;Match: Char): Integer;                  }
  18. {  ---------------------------------------------------------------         }
  19. {                                                                          }
  20. {  Effet     : Retourne la position de la première occurence de <Match>    }
  21. {              dans <Str> en recherchant à partir de la droite ou 0 si     }
  22. {              <Match> n'est pas trouvé.                                   }
  23. {                                                                          }
  24. {  Usage     : Chaîne pascal.                                              }
  25. {                                                                          }
  26. {  Vitesse   : 7800/s                                                      }
  27. {                                                                          }
  28. { -------------------------------------------------------------------------}
  29.  
  30. Procedure Test1;
  31. Begin
  32.   S1 := 'abcdefghijklmnopqrstuvwxyz';
  33.   I := ChrPosR(S1,'m');
  34.   S1 := '3.14116';
  35.   I := ChrPosR(S1,'0');
  36. end;
  37.  
  38. {  ---------------------------------------------------------------         }
  39. {  Function    ChrPosRN(Str: String;Match: Char;Occur: Byte):Integer;      }
  40. {  ---------------------------------------------------------------         }
  41. {                                                                          }
  42. {  Effet     : Identique à ChrPosR, mais pour la <Occur>ème occurence.     }
  43. {                                                                          }
  44. {  Usage     : Idem.                                                       }
  45. {                                                                          }
  46. {  Vitesse   : 7800/s                                                      }
  47. {                                                                          }
  48. { -------------------------------------------------------------------------}
  49.  
  50. Procedure Test2;
  51. Begin
  52.   S1 := 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz';
  53.   I := ChrPosRN(S1,'a',2);
  54.   S1 := '3.14116';
  55.   I := ChrPosRN(S1,'1',3);
  56. end;
  57.  
  58. {  ---------------------------------------------------------------         }
  59. {  Function    ChrPosRI(Str: String;Match: Char):Integer;                  }
  60. {  ---------------------------------------------------------------         }
  61. {                                                                          }
  62. {  Effet     : Identique à ChrPosR, mais ne tient pas compte des           }
  63. {              majuscules/minuscules.                                      }
  64. {                                                                          }
  65. {  Usage     : Idem.                                                       }
  66. {                                                                          }
  67. {  Vitesse   : 7800/s                                                      }
  68. {                                                                          }
  69. { -------------------------------------------------------------------------}
  70.  
  71. Procedure Test3;
  72. Begin
  73.   S1 := 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz';
  74.   I := ChrPosRI(S1,'A');
  75. end;
  76.  
  77. {  ---------------------------------------------------------------         }
  78. {  Function    ChrPosRIN(Str: String;Match: Char;Occur:Byte):Integer;      }
  79. {  ---------------------------------------------------------------         }
  80. {                                                                          }
  81. {  Effet     : combinaison de ChrPosRI et de ChrPosRN.                     }
  82. {                                                                          }
  83. {  Usage     : Idem.                                                       }
  84. {                                                                          }
  85. {  Vitesse   : 7800/s                                                      }
  86. {                                                                          }
  87. { -------------------------------------------------------------------------}
  88.  
  89. Procedure Test4;
  90. Begin
  91.   S1 := 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz';
  92.   I := ChrPosRIN(S1,'A',2);
  93.   I := ChrPosRIN(S1,'A',1);
  94. end;
  95.  
  96. Begin
  97.   Test1;
  98.   Test2;
  99.   Test3;
  100.   Test4;
  101. End.
  102.  
  103. { -------------------------------------------------------------------------}
  104.